//
// Created by Tony on 2024/1/14.
//

#ifndef PARSER_AST_H
#define PARSER_AST_H

#include "../../lexer/token/Token.h"
#include <cstdint>
#include <memory>
#include <vector>

namespace Compiler {
class Visitor;
}

namespace Parser {

using std::shared_ptr;
using std::static_pointer_cast;
using std::string;
using std::vector;

class Ast {
public:
    virtual ~Ast() = default;

    virtual size_t numChildren() = 0;
    virtual vector<shared_ptr<Ast>> getChildren() = 0;
    virtual shared_ptr<Ast> child(int index) = 0;
    virtual Lexer::Position position() = 0;

    virtual bool isName() { return false; }
    virtual bool isBinaryExpr() { return false; }

    virtual int32_t accept(Compiler::Visitor* visitor) = 0;
};
} // namespace Parser

#endif // PARSER_AST_H
